<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Limit_model extends MY_Model {

	protected $table = 'limit';
	public function delete($tel) {
		$tel = $this->db->where(array('tel'=>$tel))->delete($this->table);
		return $tel;
	}
	//验证码次数的限制
	public function check_code_nums($phone) {
		$count = $this->get_count_all(array('tel'=>$phone),'limit');
		return $count > PHONE_CODE_ERROE_NUMS ? false : true;
	}
	//验证码验证
	public function check_phone_code($phone,$code) {
		if($this->check_code_nums($phone)) {
			$code = $this->get_one(array('tel'=>$phone,'code'=>$code));
			return $code ? true : false;
		}
		return false;
	}
}